﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 人类_计算
{
    public class Excute
    {
        public static void Main(string[] args)
        {
            Person person = new Person();
            person.Age = 10;
            person.Name = "小智";
            person.ShowInfo();


            var a = new Calculate(MathOperation.Add);
            var b = new Calculate(MathOperation.Multiply);

            int c = 10; int d = 20;
            Console.WriteLine($"现有两个数字分别为{c}和{d}");
            Console.WriteLine($"两者相加为：{a.Invoke(c,d)}");
            Console.WriteLine($"两者相乘为：{b.Invoke(c,d)}");
        }

        public delegate int Calculate(int A, int B);

        public static class MathOperation
        {
            public static int Add(int A,int B)
            {
                return A + B;
            }

            public static int Multiply(int A, int B)
            {
                return A * B;
            }
        }
    }
}
